.class public Lcom/glympse/android/glympseservice/GlympseService;
.super Landroid/app/Service;
.source "GlympseService.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/glympse/android/glympseservice/GlympseService$GlympseListenerUI;
    }
.end annotation


# static fields
.field public static final KILL_ON_EXIT:Z = true

.field public static ms_oThis:Lcom/glympse/android/glympseservice/GlympseService;


# instance fields
.field public m_fInitialPacketReceived:Z

.field public m_fPerformedLocationCheck:Z

.field public m_fPerformedMenuPopup:Z

.field public m_fSignInError:Z

.field public m_fSplashShown:Z

.field private m_oFacebookWrapper:Lcom/glympse/android/glympseservice/FacebookWrapper;

.field public m_oGlympseListenerUI:Lcom/glympse/android/glympseservice/GlympseService$GlympseListenerUI;

.field public m_oNotificationList:Lcom/glympse/android/glympseservice/NotificationList;

.field protected m_oPlatform:Lcom/glympse/platform/Platform;

.field public m_strDeviceId:Ljava/lang/String;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 36
    const/4 v0, 0x0

    sput-object v0, Lcom/glympse/android/glympseservice/GlympseService;->ms_oThis:Lcom/glympse/android/glympseservice/GlympseService;

    .line 32
    return-void
.end method

.method public constructor <init>()V
    .locals 2

    .prologue
    const/4 v1, 0x0

    const/4 v0, 0x0

    .line 50
    invoke-direct {p0}, Landroid/app/Service;-><init>()V

    .line 38
    iput-object v1, p0, Lcom/glympse/android/glympseservice/GlympseService;->m_oPlatform:Lcom/glympse/platform/Platform;

    .line 39
    iput-object v1, p0, Lcom/glympse/android/glympseservice/GlympseService;->m_oGlympseListenerUI:Lcom/glympse/android/glympseservice/GlympseService$GlympseListenerUI;

    .line 40
    iput-object v1, p0, Lcom/glympse/android/glympseservice/GlympseService;->m_strDeviceId:Ljava/lang/String;

    .line 41
    iput-boolean v0, p0, Lcom/glympse/android/glympseservice/GlympseService;->m_fPerformedLocationCheck:Z

    .line 42
    iput-boolean v0, p0, Lcom/glympse/android/glympseservice/GlympseService;->m_fPerformedMenuPopup:Z

    .line 43
    iput-boolean v0, p0, Lcom/glympse/android/glympseservice/GlympseService;->m_fSplashShown:Z

    .line 44
    iput-boolean v0, p0, Lcom/glympse/android/glympseservice/GlympseService;->m_fSignInError:Z

    .line 45
    iput-boolean v0, p0, Lcom/glympse/android/glympseservice/GlympseService;->m_fInitialPacketReceived:Z

    .line 46
    iput-object v1, p0, Lcom/glympse/android/glympseservice/GlympseService;->m_oFacebookWrapper:Lcom/glympse/android/glympseservice/FacebookWrapper;

    .line 47
    new-instance v0, Lcom/glympse/android/glympseservice/NotificationList;

    invoke-direct {v0}, Lcom/glympse/android/glympseservice/NotificationList;-><init>()V

    iput-object v0, p0, Lcom/glympse/android/glympseservice/GlympseService;->m_oNotificationList:Lcom/glympse/android/glympseservice/NotificationList;

    .line 52
    new-instance v0, Ljava/lang/StringBuilder;

    const-string v1, "GlympseService::GlympseService - Service:"

    invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    sget-object v1, Lcom/glympse/android/glympseservice/GlympseService;->ms_oThis:Lcom/glympse/android/glympseservice/GlympseService;

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, ", Glympse:"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    sget-object v1, Lcom/glympse/android/glympse/Glympse;->ms_oThis:Lcom/glympse/android/glympse/Glympse;

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Lcom/glympse/platform/common/Helpers;->Log(Ljava/lang/String;)V

    .line 54
    sput-object p0, Lcom/glympse/android/glympseservice/GlympseService;->ms_oThis:Lcom/glympse/android/glympseservice/GlympseService;

    .line 57
    invoke-static {p0}, Lcom/glympse/android/glympseservice/ErrorReporter;->Create(Landroid/content/Context;)V

    .line 58
    return-void
.end method

.method public static SaveLocationProviderSetting()V
    .locals 3

    .prologue
    .line 393
    :try_start_0
    invoke-static {}, Lcom/glympse/platform/Platform;->instance()Lcom/glympse/platform/Platform;

    move-result-object v1

    iget-object v1, v1, Lcom/glympse/platform/Platform;->m_oConfig:Lcom/glympse/platform/Config;

    iget v1, v1, Lcom/glympse/platform/Config;->m_eLocProviderPersist:I

    invoke-static {}, Lcom/glympse/platform/Platform;->instance()Lcom/glympse/platform/Platform;

    move-result-object v2

    iget-object v2, v2, Lcom/glympse/platform/Platform;->m_oConfig:Lcom/glympse/platform/Config;

    iget v2, v2, Lcom/glympse/platform/Config;->m_eLocProviderThisRun:I

    if-eq v1, v2, :cond_0

    .line 395
    new-instance v1, Ljava/lang/StringBuilder;

    const-string v2, "SaveLocationProviderSetting: Saving Location Provider setting of: "

    invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-static {}, Lcom/glympse/platform/Platform;->instance()Lcom/glympse/platform/Platform;

    move-result-object v2

    iget-object v2, v2, Lcom/glympse/platform/Platform;->m_oConfig:Lcom/glympse/platform/Config;

    iget v2, v2, Lcom/glympse/platform/Config;->m_eLocProviderThisRun:I

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v1}, Lcom/glympse/platform/common/Helpers;->Log(Ljava/lang/String;)V

    .line 396
    invoke-static {}, Lcom/glympse/platform/Platform;->instance()Lcom/glympse/platform/Platform;

    move-result-object v1

    iget-object v1, v1, Lcom/glympse/platform/Platform;->m_oConfig:Lcom/glympse/platform/Config;

    invoke-static {}, Lcom/glympse/platform/Platform;->instance()Lcom/glympse/platform/Platform;

    move-result-object v2

    iget-object v2, v2, Lcom/glympse/platform/Platform;->m_oConfig:Lcom/glympse/platform/Config;

    iget v2, v2, Lcom/glympse/platform/Config;->m_eLocProviderThisRun:I

    iput v2, v1, Lcom/glympse/platform/Config;->m_eLocProviderPersist:I

    .line 397
    invoke-static {}, Lcom/glympse/platform/Platform;->instance()Lcom/glympse/platform/Platform;

    move-result-object v1

    iget-object v1, v1, Lcom/glympse/platform/Platform;->m_oConfig:Lcom/glympse/platform/Config;

    invoke-virtual {v1}, Lcom/glympse/platform/Config;->Save()V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 404
    :cond_0
    :goto_0
    return-void

    .line 400
    :catch_0
    move-exception v1

    move-object v0, v1

    .line 402
    .local v0, e:Ljava/lang/Exception;
    invoke-static {v0}, Lcom/glympse/platform/common/Helpers;->Log(Ljava/lang/Throwable;)V

    goto :goto_0
.end method


# virtual methods
.method public GetFacebook()Lcom/glympse/android/glympseservice/FacebookWrapper;
    .locals 2

    .prologue
    .line 367
    iget-object v1, p0, Lcom/glympse/android/glympseservice/GlympseService;->m_oFacebookWrapper:Lcom/glympse/android/glympseservice/FacebookWrapper;

    if-nez v1, :cond_0

    sget-object v1, Lcom/glympse/android/glympse/Glympse;->ms_oThis:Lcom/glympse/android/glympse/Glympse;

    if-eqz v1, :cond_0

    .line 371
    :try_start_0
    new-instance v1, Lcom/glympse/android/glympseservice/FacebookWrapper;

    invoke-direct {v1}, Lcom/glympse/android/glympseservice/FacebookWrapper;-><init>()V

    iput-object v1, p0, Lcom/glympse/android/glympseservice/GlympseService;->m_oFacebookWrapper:Lcom/glympse/android/glympseservice/FacebookWrapper;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 378
    :cond_0
    :goto_0
    iget-object v1, p0, Lcom/glympse/android/glympseservice/GlympseService;->m_oFacebookWrapper:Lcom/glympse/android/glympseservice/FacebookWrapper;

    return-object v1

    .line 373
    :catch_0
    move-exception v1

    move-object v0, v1

    .line 375
    .local v0, e:Ljava/lang/Exception;
    invoke-static {v0}, Lcom/glympse/platform/common/Helpers;->Log(Ljava/lang/Throwable;)V

    goto :goto_0
.end method

.method public IsEmulator()Z
    .locals 1

    .prologue
    .line 384
    const/4 v0, 0x0

    return v0
.end method

.method public IsNetworkError()Z
    .locals 2

    .prologue
    .line 359
    invoke-static {}, Lcom/glympse/platform/Platform;->instance()Lcom/glympse/platform/Platform;

    move-result-object v0

    iget-boolean v0, v0, Lcom/glympse/platform/Platform;->m_fInitalPacketReceived:Z

    if-eqz v0, :cond_0

    invoke-static {}, Lcom/glympse/platform/Platform;->instance()Lcom/glympse/platform/Platform;

    move-result-object v0

    iget-object v0, v0, Lcom/glympse/platform/Platform;->m_oServerPost:Lcom/glympse/platform/common/ServerPost;

    invoke-virtual {v0}, Lcom/glympse/platform/common/ServerPost;->GetFailureCount()I

    move-result v0

    const/4 v1, 0x2

    if-gt v0, v1, :cond_1

    .line 360
    :cond_0
    iget-boolean v0, p0, Lcom/glympse/android/glympseservice/GlympseService;->m_fSignInError:Z

    if-nez v0, :cond_1

    invoke-static {}, Lcom/glympse/platform/Platform;->instance()Lcom/glympse/platform/Platform;

    move-result-object v0

    iget-object v0, v0, Lcom/glympse/platform/Platform;->m_strSignInError:Ljava/lang/String;

    invoke-static {v0}, Lcom/glympse/platform/common/Helpers;->IsEmpty(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_1

    const/4 v0, 0x0

    :goto_0
    return v0

    :cond_1
    const/4 v0, 0x1

    .line 359
    goto :goto_0
.end method

.method public ProcessIntent(Landroid/content/Intent;)V
    .locals 10
    .parameter "oIntent"

    .prologue
    .line 242
    invoke-virtual {p1}, Landroid/content/Intent;->getAction()Ljava/lang/String;

    move-result-object v5

    .line 243
    .local v5, strAction:Ljava/lang/String;
    invoke-static {v5}, Lcom/glympse/platform/common/Helpers;->IsEmpty(Ljava/lang/String;)Z

    move-result v7

    if-nez v7, :cond_0

    const-string v7, "GLYMPSE_ACTION"

    invoke-virtual {v5, v7}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z

    move-result v7

    if-nez v7, :cond_1

    .line 316
    :cond_0
    :goto_0
    return-void

    .line 249
    :cond_1
    new-instance v7, Lcom/glympse/platform/common/CharArrayPointer;

    invoke-direct {v7, v5}, Lcom/glympse/platform/common/CharArrayPointer;-><init>(Ljava/lang/String;)V

    invoke-static {v7}, Lcom/glympse/platform/common/Helpers;->ParseNameValuePairs(Lcom/glympse/platform/common/CharArrayPointer;)Lcom/glympse/platform/GVector$NameValueNodes;

    move-result-object v2

    .line 250
    .local v2, listNameValues:Lcom/glympse/platform/GVector$NameValueNodes;,"Lcom/glympse/platform/GVector$NameValueNodes;"
    if-eqz v2, :cond_0

    .line 255
    const/4 v6, 0x0

    .line 256
    .local v6, strType:Ljava/lang/String;
    const-wide/16 v0, 0x0

    .line 257
    .local v0, lTicketId:J
    const/4 v3, 0x0

    .line 260
    .local v3, nNotificationId:I
    invoke-virtual {v2}, Lcom/glympse/platform/GVector$NameValueNodes;->iterator()Ljava/util/Iterator;

    move-result-object v7

    :cond_2
    :goto_1
    invoke-interface {v7}, Ljava/util/Iterator;->hasNext()Z

    move-result v8

    if-nez v8, :cond_4

    .line 281
    invoke-static {v6}, Lcom/glympse/platform/common/Helpers;->IsEmpty(Ljava/lang/String;)Z

    move-result v7

    if-nez v7, :cond_0

    .line 286
    new-instance v7, Ljava/lang/StringBuilder;

    const-string v8, "[GLYMPSE_ACTION] type: "

    invoke-direct {v7, v8}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v7, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    const-string v8, ", ticket: "

    invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    invoke-virtual {v7, v0, v1}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    move-result-object v7

    const-string v8, ", notification: "

    invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    invoke-virtual {v7, v3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v7

    invoke-virtual {v7}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v7

    invoke-static {v7}, Lcom/glympse/platform/common/Helpers;->Log(Ljava/lang/String;)V

    .line 289
    const-string v7, "expire"

    invoke-virtual {v6, v7}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v7

    if-eqz v7, :cond_7

    .line 292
    const-wide/16 v7, 0x0

    cmp-long v7, v7, v0

    if-eqz v7, :cond_3

    invoke-static {}, Lcom/glympse/platform/Platform;->instance()Lcom/glympse/platform/Platform;

    move-result-object v7

    if-eqz v7, :cond_3

    invoke-static {}, Lcom/glympse/platform/Platform;->instance()Lcom/glympse/platform/Platform;

    move-result-object v7

    iget-object v7, v7, Lcom/glympse/platform/Platform;->m_oSentTickets:Lcom/glympse/platform/common/SentTicketList;

    if-eqz v7, :cond_3

    .line 294
    invoke-static {}, Lcom/glympse/platform/Platform;->instance()Lcom/glympse/platform/Platform;

    move-result-object v7

    iget-object v7, v7, Lcom/glympse/platform/Platform;->m_oSentTickets:Lcom/glympse/platform/common/SentTicketList;

    invoke-static {}, Lcom/glympse/platform/Platform;->instance()Lcom/glympse/platform/Platform;

    move-result-object v8

    iget-object v8, v8, Lcom/glympse/platform/Platform;->m_oSentTickets:Lcom/glympse/platform/common/SentTicketList;

    invoke-virtual {v8, v0, v1}, Lcom/glympse/platform/common/SentTicketList;->FindTicket(J)Lcom/glympse/platform/common/Ticket;

    move-result-object v8

    invoke-virtual {v7, v8}, Lcom/glympse/platform/common/SentTicketList;->ExpireTicket(Lcom/glympse/platform/common/Ticket;)Z

    move-result v7

    if-eqz v7, :cond_3

    .line 296
    invoke-static {}, Lcom/glympse/platform/Platform;->instance()Lcom/glympse/platform/Platform;

    move-result-object v7

    iget-object v7, v7, Lcom/glympse/platform/Platform;->m_oServerPost:Lcom/glympse/platform/common/ServerPost;

    invoke-virtual {v7}, Lcom/glympse/platform/common/ServerPost;->PostNow()V

    .line 301
    :cond_3
    if-eqz v3, :cond_0

    iget-object v7, p0, Lcom/glympse/android/glympseservice/GlympseService;->m_oNotificationList:Lcom/glympse/android/glympseservice/NotificationList;

    if-eqz v7, :cond_0

    .line 303
    iget-object v7, p0, Lcom/glympse/android/glympseservice/GlympseService;->m_oNotificationList:Lcom/glympse/android/glympseservice/NotificationList;

    invoke-virtual {v7, v3}, Lcom/glympse/android/glympseservice/NotificationList;->Remove(I)Z

    goto/16 :goto_0

    .line 260
    :cond_4
    invoke-interface {v7}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v4

    check-cast v4, Lcom/glympse/platform/common/NameValueNode;

    .line 263
    .local v4, oNameValueNode:Lcom/glympse/platform/common/NameValueNode;
    iget-object v8, v4, Lcom/glympse/platform/common/NameValueNode;->m_strName:Ljava/lang/String;

    invoke-static {v8}, Lcom/glympse/platform/common/Helpers;->IsEmpty(Ljava/lang/String;)Z

    move-result v8

    if-nez v8, :cond_2

    iget-object v8, v4, Lcom/glympse/platform/common/NameValueNode;->m_strValue:Ljava/lang/String;

    if-eqz v8, :cond_2

    .line 265
    iget-object v8, v4, Lcom/glympse/platform/common/NameValueNode;->m_strName:Ljava/lang/String;

    const-string v9, "type"

    invoke-virtual {v8, v9}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v8

    if-eqz v8, :cond_5

    .line 267
    iget-object v6, v4, Lcom/glympse/platform/common/NameValueNode;->m_strValue:Ljava/lang/String;

    goto/16 :goto_1

    .line 269
    :cond_5
    iget-object v8, v4, Lcom/glympse/platform/common/NameValueNode;->m_strName:Ljava/lang/String;

    const-string v9, "tid"

    invoke-virtual {v8, v9}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v8

    if-eqz v8, :cond_6

    .line 271
    iget-object v8, v4, Lcom/glympse/platform/common/NameValueNode;->m_strValue:Ljava/lang/String;

    invoke-static {v8}, Lcom/glympse/platform/common/Helpers;->ParseLong(Ljava/lang/String;)J

    move-result-wide v0

    goto/16 :goto_1

    .line 273
    :cond_6
    iget-object v8, v4, Lcom/glympse/platform/common/NameValueNode;->m_strName:Ljava/lang/String;

    const-string v9, "nid"

    invoke-virtual {v8, v9}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v8

    if-eqz v8, :cond_2

    .line 275
    iget-object v8, v4, Lcom/glympse/platform/common/NameValueNode;->m_strValue:Ljava/lang/String;

    invoke-static {v8}, Lcom/glympse/platform/common/Helpers;->ParseInt(Ljava/lang/String;)I

    move-result v3

    goto/16 :goto_1

    .line 308
    .end local v4           #oNameValueNode:Lcom/glympse/platform/common/NameValueNode;
    :cond_7
    const-string v7, "clear"

    invoke-virtual {v6, v7}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v7

    if-eqz v7, :cond_0

    .line 311
    if-eqz v3, :cond_0

    iget-object v7, p0, Lcom/glympse/android/glympseservice/GlympseService;->m_oNotificationList:Lcom/glympse/android/glympseservice/NotificationList;

    if-eqz v7, :cond_0

    .line 313
    iget-object v7, p0, Lcom/glympse/android/glympseservice/GlympseService;->m_oNotificationList:Lcom/glympse/android/glympseservice/NotificationList;

    invoke-virtual {v7, v3}, Lcom/glympse/android/glympseservice/NotificationList;->Remove(I)Z

    goto/16 :goto_0
.end method

.method public StartListener()V
    .locals 2

    .prologue
    .line 332
    iget-object v0, p0, Lcom/glympse/android/glympseservice/GlympseService;->m_oPlatform:Lcom/glympse/platform/Platform;

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/glympse/android/glympseservice/GlympseService;->m_oGlympseListenerUI:Lcom/glympse/android/glympseservice/GlympseService$GlympseListenerUI;

    if-nez v0, :cond_0

    .line 334
    new-instance v0, Lcom/glympse/android/glympseservice/GlympseService$GlympseListenerUI;

    invoke-direct {v0, p0}, Lcom/glympse/android/glympseservice/GlympseService$GlympseListenerUI;-><init>(Lcom/glympse/android/glympseservice/GlympseService;)V

    iput-object v0, p0, Lcom/glympse/android/glympseservice/GlympseService;->m_oGlympseListenerUI:Lcom/glympse/android/glympseservice/GlympseService$GlympseListenerUI;

    .line 335
    iget-object v0, p0, Lcom/glympse/android/glympseservice/GlympseService;->m_oPlatform:Lcom/glympse/platform/Platform;

    iget-object v1, p0, Lcom/glympse/android/glympseservice/GlympseService;->m_oGlympseListenerUI:Lcom/glympse/android/glympseservice/GlympseService$GlympseListenerUI;

    invoke-virtual {v0, v1}, Lcom/glympse/platform/Platform;->AddGlympseListener(Lcom/glympse/platform/common/GlympseListener;)V

    .line 337
    :cond_0
    return-void
.end method

.method public StartSignIn()V
    .locals 1

    .prologue
    .line 321
    iget-object v0, p0, Lcom/glympse/android/glympseservice/GlympseService;->m_oPlatform:Lcom/glympse/platform/Platform;

    if-eqz v0, :cond_0

    .line 324
    invoke-virtual {p0}, Lcom/glympse/android/glympseservice/GlympseService;->StartListener()V

    .line 325
    iget-object v0, p0, Lcom/glympse/android/glympseservice/GlympseService;->m_oPlatform:Lcom/glympse/platform/Platform;

    invoke-virtual {v0}, Lcom/glympse/platform/Platform;->SignIn()V

    .line 327
    :cond_0
    return-void
.end method

.method public StopListener()V
    .locals 2

    .prologue
    .line 342
    iget-object v0, p0, Lcom/glympse/android/glympseservice/GlympseService;->m_oPlatform:Lcom/glympse/platform/Platform;

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/glympse/android/glympseservice/GlympseService;->m_oGlympseListenerUI:Lcom/glympse/android/glympseservice/GlympseService$GlympseListenerUI;

    if-eqz v0, :cond_0

    .line 344
    iget-object v0, p0, Lcom/glympse/android/glympseservice/GlympseService;->m_oPlatform:Lcom/glympse/platform/Platform;

    iget-object v1, p0, Lcom/glympse/android/glympseservice/GlympseService;->m_oGlympseListenerUI:Lcom/glympse/android/glympseservice/GlympseService$GlympseListenerUI;

    invoke-virtual {v0, v1}, Lcom/glympse/platform/Platform;->RemoveGlympseListener(Lcom/glympse/platform/common/GlympseListener;)V

    .line 345
    const/4 v0, 0x0

    iput-object v0, p0, Lcom/glympse/android/glympseservice/GlympseService;->m_oGlympseListenerUI:Lcom/glympse/android/glympseservice/GlympseService$GlympseListenerUI;

    .line 347
    :cond_0
    return-void
.end method

.method protected finalize()V
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/Throwable;
        }
    .end annotation

    .prologue
    .line 63
    const-string v0, "GlympseService::finalize"

    invoke-static {v0}, Lcom/glympse/platform/common/Helpers;->Log(Ljava/lang/String;)V

    .line 64
    invoke-super {p0}, Landroid/app/Service;->finalize()V

    .line 65
    sget-object v0, Lcom/glympse/android/glympseservice/GlympseService;->ms_oThis:Lcom/glympse/android/glympseservice/GlympseService;

    if-ne v0, p0, :cond_0

    .line 67
    const/4 v0, 0x0

    sput-object v0, Lcom/glympse/android/glympseservice/GlympseService;->ms_oThis:Lcom/glympse/android/glympseservice/GlympseService;

    .line 69
    :cond_0
    return-void
.end method

.method public onBind(Landroid/content/Intent;)Landroid/os/IBinder;
    .locals 1
    .parameter "intent"

    .prologue
    .line 187
    const-string v0, "GlympseService::onBind"

    invoke-static {v0}, Lcom/glympse/platform/common/Helpers;->Log(Ljava/lang/String;)V

    .line 188
    const/4 v0, 0x0

    return-object v0
.end method

.method public onCreate()V
    .locals 4

    .prologue
    .line 74
    const-string v0, "GlympseService::onCreate"

    invoke-static {v0}, Lcom/glympse/platform/common/Helpers;->Log(Ljava/lang/String;)V

    .line 75
    invoke-super {p0}, Landroid/app/Service;->onCreate()V

    .line 85
    :try_start_0
    invoke-virtual {p0}, Lcom/glympse/android/glympseservice/GlympseService;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    const-string v1, "android_id"

    invoke-static {v0, v1}, Landroid/provider/Settings$Secure;->getString(Landroid/content/ContentResolver;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    iput-object v0, p0, Lcom/glympse/android/glympseservice/GlympseService;->m_strDeviceId:Ljava/lang/String;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 90
    :goto_0
    iget-object v0, p0, Lcom/glympse/android/glympseservice/GlympseService;->m_strDeviceId:Ljava/lang/String;

    invoke-static {v0}, Lcom/glympse/platform/common/Helpers;->IsEmpty(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_0

    .line 92
    const-string v0, "Unable to read Device ID. Assuming we are running in the emulator."

    invoke-static {v0}, Lcom/glympse/platform/common/Helpers;->Log(Ljava/lang/String;)V

    .line 96
    :cond_0
    iget-object v0, p0, Lcom/glympse/android/glympseservice/GlympseService;->m_oPlatform:Lcom/glympse/platform/Platform;

    if-nez v0, :cond_1

    .line 99
    sput-object p0, Lcom/glympse/platform/Platform;->m_oContext:Landroid/content/Context;

    .line 107
    new-instance v0, Lcom/glympse/platform/Platform;

    sget-object v1, Lcom/glympse/android/glympse/Glympse;->ms_oThis:Lcom/glympse/android/glympse/Glympse;

    if-eqz v1, :cond_3

    sget-object v1, Lcom/glympse/android/glympse/Glympse;->ms_oThis:Lcom/glympse/android/glympse/Glympse;

    iget-boolean v1, v1, Lcom/glympse/android/glympse/Glympse;->m_fActive:Z

    :goto_1
    invoke-direct {v0, p0, v1}, Lcom/glympse/platform/Platform;-><init>(Landroid/content/Context;Z)V

    iput-object v0, p0, Lcom/glympse/android/glympseservice/GlympseService;->m_oPlatform:Lcom/glympse/platform/Platform;

    .line 111
    :cond_1
    iget-object v0, p0, Lcom/glympse/android/glympseservice/GlympseService;->m_oNotificationList:Lcom/glympse/android/glympseservice/NotificationList;

    invoke-virtual {v0}, Lcom/glympse/android/glympseservice/NotificationList;->RemoveAll()V

    .line 121
    iget-object v0, p0, Lcom/glympse/android/glympseservice/GlympseService;->m_oPlatform:Lcom/glympse/platform/Platform;

    iget-object v0, v0, Lcom/glympse/platform/Platform;->m_oConfig:Lcom/glympse/platform/Config;

    invoke-virtual {v0}, Lcom/glympse/platform/Config;->HasAcceptedEula()Z

    move-result v0

    if-eqz v0, :cond_2

    invoke-static {}, Lcom/glympse/platform/Platform;->instance()Lcom/glympse/platform/Platform;

    move-result-object v0

    iget-object v0, v0, Lcom/glympse/platform/Platform;->m_oConfig:Lcom/glympse/platform/Config;

    iget-wide v0, v0, Lcom/glympse/platform/Config;->m_lExpireTime:J

    invoke-static {}, Lcom/glympse/platform/common/CorrectedTime;->GetTime()J

    move-result-wide v2

    cmp-long v0, v0, v2

    if-ltz v0, :cond_2

    .line 123
    iget-object v0, p0, Lcom/glympse/android/glympseservice/GlympseService;->m_oNotificationList:Lcom/glympse/android/glympseservice/NotificationList;

    invoke-virtual {v0}, Lcom/glympse/android/glympseservice/NotificationList;->Update()V

    .line 126
    invoke-virtual {p0}, Lcom/glympse/android/glympseservice/GlympseService;->StartSignIn()V

    .line 128
    :cond_2
    return-void

    .line 107
    :cond_3
    const/4 v1, 0x0

    goto :goto_1

    .line 87
    :catch_0
    move-exception v0

    goto :goto_0
.end method

.method public onDestroy()V
    .locals 3

    .prologue
    const/4 v2, 0x0

    .line 194
    const-string v1, "GlympseService::onDestroy"

    invoke-static {v1}, Lcom/glympse/platform/common/Helpers;->Log(Ljava/lang/String;)V

    .line 197
    iget-object v1, p0, Lcom/glympse/android/glympseservice/GlympseService;->m_oNotificationList:Lcom/glympse/android/glympseservice/NotificationList;

    invoke-virtual {v1}, Lcom/glympse/android/glympseservice/NotificationList;->RemoveAll()V

    .line 201
    :try_start_0
    invoke-super {p0}, Landroid/app/Service;->onDestroy()V

    .line 203
    invoke-static {}, Lcom/glympse/android/glympseservice/GlympseService;->SaveLocationProviderSetting()V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 216
    :goto_0
    invoke-virtual {p0}, Lcom/glympse/android/glympseservice/GlympseService;->StopListener()V

    .line 218
    invoke-static {}, Lcom/glympse/platform/Platform;->instance()Lcom/glympse/platform/Platform;

    move-result-object v1

    if-eqz v1, :cond_0

    .line 220
    invoke-static {}, Lcom/glympse/platform/Platform;->instance()Lcom/glympse/platform/Platform;

    move-result-object v1

    invoke-virtual {v1}, Lcom/glympse/platform/Platform;->Destroy()V

    .line 222
    :cond_0
    iput-object v2, p0, Lcom/glympse/android/glympseservice/GlympseService;->m_oFacebookWrapper:Lcom/glympse/android/glympseservice/FacebookWrapper;

    .line 223
    iput-object v2, p0, Lcom/glympse/android/glympseservice/GlympseService;->m_oPlatform:Lcom/glympse/platform/Platform;

    .line 224
    sput-object v2, Lcom/glympse/android/glympseservice/GlympseService;->ms_oThis:Lcom/glympse/android/glympseservice/GlympseService;

    .line 233
    const-string v1, "Calling Kill from service"

    invoke-static {v1}, Lcom/glympse/platform/common/Helpers;->Log(Ljava/lang/String;)V

    .line 234
    invoke-static {}, Landroid/os/Process;->myPid()I

    move-result v1

    invoke-static {v1}, Landroid/os/Process;->killProcess(I)V

    .line 235
    const-string v1, "Kill called from service"

    invoke-static {v1}, Lcom/glympse/platform/common/Helpers;->Log(Ljava/lang/String;)V

    .line 237
    return-void

    .line 211
    :catch_0
    move-exception v1

    move-object v0, v1

    .line 213
    .local v0, e:Ljava/lang/Exception;
    invoke-static {v0}, Lcom/glympse/platform/common/Helpers;->Log(Ljava/lang/Throwable;)V

    goto :goto_0
.end method

.method public onStart(Landroid/content/Intent;I)V
    .locals 2
    .parameter "oIntent"
    .parameter "nStartId"

    .prologue
    .line 149
    :try_start_0
    const-string v1, "GlympseService::onStart"

    invoke-static {v1}, Lcom/glympse/platform/common/Helpers;->Log(Ljava/lang/String;)V

    .line 151
    invoke-super {p0, p1, p2}, Landroid/app/Service;->onStart(Landroid/content/Intent;I)V

    .line 164
    invoke-virtual {p0}, Lcom/glympse/android/glympseservice/GlympseService;->GetFacebook()Lcom/glympse/android/glympseservice/FacebookWrapper;

    .line 167
    sget-object v1, Lcom/glympse/android/glympse/Glympse;->ms_oThis:Lcom/glympse/android/glympse/Glympse;

    if-eqz v1, :cond_0

    .line 169
    sget-object v1, Lcom/glympse/android/glympse/Glympse;->ms_oThis:Lcom/glympse/android/glympse/Glympse;

    invoke-virtual {v1}, Lcom/glympse/android/glympse/Glympse;->ServiceStarted()V

    .line 173
    :cond_0
    if-eqz p1, :cond_1

    .line 175
    invoke-virtual {p0, p1}, Lcom/glympse/android/glympseservice/GlympseService;->ProcessIntent(Landroid/content/Intent;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 182
    :cond_1
    :goto_0
    return-void

    .line 178
    :catch_0
    move-exception v1

    move-object v0, v1

    .line 180
    .local v0, e:Ljava/lang/Exception;
    invoke-static {v0}, Lcom/glympse/platform/common/Helpers;->Log(Ljava/lang/Throwable;)V

    goto :goto_0
.end method

.method public onStartCommand(Landroid/content/Intent;II)I
    .locals 2
    .parameter "oIntent"
    .parameter "nFlags"
    .parameter "nStartId"

    .prologue
    .line 133
    new-instance v0, Ljava/lang/StringBuilder;

    const-string v1, "GlympseService::onStartCommand(oIntent:"

    invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, ", nFlags:"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0, p2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, ", nStartId:"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0, p3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, ")"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Lcom/glympse/platform/common/Helpers;->Log(Ljava/lang/String;)V

    .line 137
    invoke-virtual {p0, p1, p3}, Lcom/glympse/android/glympseservice/GlympseService;->onStart(Landroid/content/Intent;I)V

    .line 141
    const/4 v0, 0x1

    return v0
.end method
